package com.woniuxy.charin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.charin.mapper.GroupInfoMapper;
import com.woniuxy.charin.model.entity.GroupInfo;
import com.woniuxy.charin.service.GroupInfoService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* @author 28196
* @description 针对表【group_info】的数据库操作Service实现
* @createDate 2024-12-23 21:27:49
*/
@Service
public class GroupInfoServiceImpl extends ServiceImpl<GroupInfoMapper, GroupInfo>
    implements GroupInfoService{

    public Page<GroupInfo> findGroupInfos(int page, int size, String groupName, String groupStatus, String groupType) {
        QueryWrapper<GroupInfo> queryWrapper = new QueryWrapper<>();
        if (groupName != null && !groupName.trim().isEmpty()) {
            queryWrapper.lambda().like(GroupInfo::getGroupName, groupName);
        }
        if (groupStatus != null && !groupStatus.trim().isEmpty()) {
            queryWrapper.lambda().eq(GroupInfo::getGroupStatus, groupStatus);
        }
        if (groupType != null && !groupType.trim().isEmpty()) {
            queryWrapper.lambda().eq(GroupInfo::getGroupType, groupType);
        }
        queryWrapper.orderByDesc("publish_time");

        return page(new Page<>(page, size), queryWrapper);
    }

}




